﻿using System;
using System.Collections.Generic;
using System.Text;
using LispInterpretor.HelperClasses;

namespace LispInterpretor.InBuiltProcedures.ListOperations
{
    public class First : Procedure
    {
        public override object Apply(params object[] args)
        {
            Check.IsTrue(args.Length == 1, "The procedure \"first\" only has a single argument.");

            Check.IsTrue(args[0] is IList<object>, "The procedure \"first\" requires a list passed to it as an argument.");

            IList<object> list = args[0] as IList<object>;
            
            return list[0];
        }
    }
}
